<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>已发布游记管理</title>
    <#include "../common/header.ftl"/>
    <#include "../common/page.ftl"/>
    <script>
      $(function () {
          // 查看游记信息
          $('.lookBtn').click(function() {
              var travelId =  $(this).data('id');
              $.get('/travel/getTravelById.do',{travelId:travelId},function (data) {
                  $('#showModal .modal-body').html(data.content);
              });
              $('#showModal').modal('show');
          });
          // 取消发布
          $('.cancleBtn').click(function() {
              var id = $(this).data('id');
              var state = $(this).data('state');
              // 发送请求修改游记状态
              $.post('/travel/changeState.do',{id:id,state:state},function (data) {
                  if(data.success){
                      $.messager.confirm("温馨提示","操作成功",function () {
                          window.location.reload();
                      })
                  }else {
                      $.messager.alert("温馨提示","操作失败");
                  }
              });
          });


      });
    </script>
    <style type="text/css">
        #showModal img {
            width: 100%;
        }
        #showModal .modal-body{
            max-height: 600px;
            overflow-y: auto;
        }
    </style>
</head>

<body>
<div class="container">
<#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
		<#assign currentMenu = "travel_refuse" />
				<#include "../common/menu.ftl" />
        </div>
        <div class="col-sm-9">
            <div class="page-header">
                <h3>已发布游记管理</h3>
            </div>
            <div class="row">
                <!-- 提交分页的表单 -->
                <form id="searchForm" class="form-inline" method="post" action="/travel/releaseList.do">
                    <input type="hidden" name="currentPage" id="currentPage" value="1"/>
                    <div class="form-group">
                    </div>
                    <div class="form-group">
                        <label>关键字</label>
                        <input class="form-control" type="text" name="keyword" placeholder="请输入标题/昵称"  value="${(qo.keyword)!''}">
                    </div>
                    <div class="form-group">
                        <button id="query" type="button" class="btn btn-success"><i class="icon-search"></i> 查询</button>
                    </div>
                </form>
            </div>
            <div class="row">
                <table class="table">
                    <thead>
                    <tr>
                        <th>标题</th>
                        <th>封面</th>
                        <th>地区</th>
                        <th>作者</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
					<#list result.list as vo>
                    <tr>
                        <td>${vo.title!}</td>
                        <td><img src="${vo.coverUrl!}" style="width: 60px" alt=""></td>
                        <td>${vo.place.name!}</td>
                        <td>${vo.author.nickName!}</td>
                        <td>${vo.stateDisplay}</td>
                        <td>
                            <a href="javascript:;" class="btn btn-danger cancleBtn" data-state="1" data-id="${vo.id}">撤回</a>
                            <a href="javascript:;" class="btn btn-primary lookBtn" data-id="${vo.id}"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> 查看文章</a>
                        </td>
                    </tr>
					</#list>
                    </tbody>
                </table>

                <div style="text-align: center;">
                    <ul id="pagination" class="pagination"></ul>
                </div>
            </div>
        </div>
    </div>
</div>
<#--查看游记内容-->
<div class="modal fade" id="showModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">游记详情</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>